// Copyright (c) 2008 Matthew Johnson
// Licensed under the MIT License (see license.txt)
package actionml.events {
	import flash.events.Event;
	
	import actionml.core.ObjectMethods;

	public dynamic class InteractionEvent extends Event {
		public static const CLICK_IN_PLACE:String = "clickInPlace";

		public static const EDIT:String = "edit";		
		public static const FOCUS:String = "focus";
		public static const FOCUS_OUT:String = "focusOut";
		
		public static const HOVER:String = "hover";
		public static const HOVER_OUT:String = "hoverOut";
		
		public static const DRAG:String = "drag";
		public static const START_DRAG:String = "startDrag";
		public static const END_DRAG:String = "endDrag";
		public static const ABORT_DRAG:String = "abortDrag";
		public static const DROP:String = "drop";
		public static const DROP_ON:String = "dropOn";
		public static const DRAG_IN:String = "dragIn";
		public static const DRAG_OVER:String = "dragOver";
		public static const DRAG_OUT:String = "dragOut";

		public static const CONNECT_TO:String = "connectTo";	
		public static const CONNECT_OVER:String = "connectOver";		
		public static const CONNECT_OUT:String = "connectOut";
		public static const INVALID_CONNECT_OVER:String = "invalidConnectOver";		
		public static const INVALID_CONNECT_OUT:String = "invalidConnectOut";
		
		public static const PRIMARY_SELECT:String = "primarySelect";
		public static const SELECT:String = "select";
		public static const DESELECT:String = "deselect";
		
		public static const TOGGLE:String = "toggle";
		public static const ENABLE:String = "enable";
		public static const DISABLE:String = "disable";
		public static const EMPHASIZE:String = "emphasize";
		public static const DEEMPHASIZE:String = "deemphasize";

		public static const SCROLL:String = "scroll";
		
		public static const _eventProperties = ["altKey", "ctrlKey", "shiftKey", "stageX", "stageY", "localX", "localY", "buttonDown", "delta", "keyCode", "charCode", "keyLocation", "relatedObject", "text"];
		public function InteractionEvent (type:String, e:*=null) {
			if (e) {
				for each (var p:String in _eventProperties) {
					if (p in e) {
						this[p] = e[p];
					}
				}
			}
			super(type, true);
		}
		public override function toString():String {
			return ObjectMethods.instanceMethods.toString.call(this, true);
		}
	}
}